package net.sapfree.display.tags.person;

import java.sql.Connection;
import java.sql.SQLException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.log4j.Logger;

import net.sapfree.common.Constants;
import net.sapfree.core.db.DBConnectionProvider;
import net.sapfree.core.db.DataBaseExecutor;
import net.sapfree.core.db.Record;

public class PersonModuleTag extends TagSupport {
	private Record r=null;
	private String id=null;
	private static Logger log = Logger.getLogger(PersonModuleTag.class.getClass());
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public int doStartTag() throws JspException {
		
		PersonModuleListTag personmodule = (PersonModuleListTag) pageContext.getAttribute("PersonModuleListTag");
		r=(Record)personmodule.getCurrent();
		
		float freeyear = Float.valueOf(r.getString("PPM_FREE", "0")).floatValue();
		float neibuyear = Float.valueOf(r.getString("PPM_NEIBU","0")).floatValue();
		float waibuyear = Float.valueOf(r.getString("PPM_WAIBU","0")).floatValue();
		
		r.addData("ALLYEAR", Float.valueOf(freeyear+neibuyear+waibuyear));
		
		pageContext.setAttribute("PersonModuleTag", this);
		return EVAL_BODY_INCLUDE;
	}
	
	public int doEndTag() throws JspException {
		return EVAL_PAGE;
	}
 
	
	/**
	 * @return the artName
	 */
	public Record getRecord() {
		return r;
	}

	/**
	 * @param artName the artName to set
	 */
	public void setRecord(Record _r) {
		this.r = _r;;
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}
}
